﻿@using BonjourQuotation.UI.Models.SeasonModel
@model ManageSeasonsGridViewModel

@using (@Html.BeginForm("SaveSeasonDetailData", "Season", FormMethod.Post, new { id = "LoadSeasonDetailsForm" }))
{
    <div id="ErrorMessagesDivPopUp" style="margin:auto;width:960px; height: 30px; ">
        <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
        @if (Model.Message != null)
        {
            @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
        }
    </div>

    <div style="width: 881px; min-height: 300px; max-height: 442px; margin: auto; padding-bottom: 30px; ">
        <table class="table table-bordered table-hover table-condensed" style="margin-bottom: -1px !important; width: 860px;background-color:white;">
            <thead>
                <tr>
                    <th width="20%;" class="GridHeaders">Season Code</th>
                    <th width="40%;" class="GridHeaders">Description</th>
                    <th width="15%;" class="GridHeaders">Start Date</th>
                    <th width="15%;" class="GridHeaders">Finish Date</th>
                    <th width="10%;" class="GridHeaders">IsCurrent</th>
                </tr>
            </thead>
        </table>
        <div style="height:350px; overflow-y:auto;">
            <table class="table table-bordered table-hover table-condensed" style="width: 860px; table-layout: fixed; background-color: white;">
                <tbody>
                    @for (int ind = 0; ind < Model.Rows.Count; ind++)
                    {
                        @Html.HiddenFor(model => model.Rows[ind].SeasonID)
                        if(Model.MenuManageSeasonEdit)
                        { 
                            <tr>
                                <td width="20%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].SeasonCode, new { @class = "ChangedSeasonElements table_inputs_162 table_inputs_WithoutBox ForValidation MaxLength20 Required" })</td>
                                <td width="40%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].SeasonDescription, new { @class = "ChangedSeasonElements table_inputs_334 table_inputs_WithoutBox ForValidation MaxLength50" })</td>
                                <td width="15%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].StartDate, new { @class = "ChangedSeasonElements table_inputs_120 table_inputs_WithoutBox SeasonDeteilsDataCalendarFrom ForValidation Required Date", @style = "cursor:pointer" })</td>
                                <td width="15%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].FinishDate, new { @class = "ChangedSeasonElements table_inputs_120 table_inputs_WithoutBox SeasonDeteilsDataCalendarTo ForValidation Required Date", @style = "cursor:pointer" })</td>
                                <td width="10%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsCurrent, new { @class = "ChangedSeasonElements" })</td>
                            </tr>
                        }
                        else
                        {
                             <tr>
                                <td width="20%;" >@Html.LabelForModel(Model.Rows[ind].SeasonCode, new { @class = "table_inputs_172", @style = "text-align: left" })</td>
                                <td width="40%;" >@Html.LabelForModel(Model.Rows[ind].SeasonDescription, new { @class = "table_inputs_344", @style = "text-align: left" })</td>
                                <td width="15%;" >@Html.LabelForModel(Model.Rows[ind].StartDate, new { @class = "table_inputs_129", @style = "text-align: left" })</td>
                                <td width="15%;" >@Html.LabelForModel(Model.Rows[ind].FinishDate, new { @class = "table_inputs_129", @style = "text-align: left" })</td>
                                <td width="10%;" >@Html.LabelForModel(Model.Rows[ind].IsCurrent ? "Yes" : "No", new { @class = "table_inputs_85", @style = "text-align: left" })</td>
                            </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
}
<div style="float: right; height: 25px; width: 140px; margin-right: 95px; ">
    <button class="btn14 btn60" style="float: left;@(@Model.IsCanView ? "" : "Display:none ")" type="button" id="SeasonMoreBtn">More</button>
    @if (Model.MenuManageSeasonEdit)
    {
        <button class="btn14 btn50" style="float: right;" type="button" id="SeasonDetailsSaveBtn">Save</button>
    }
    else
    { 
        <button class="btn14 btn50" style="float: right;" type="button" disabled="disabled" id="SeasonDetailsSaveBtn">Save</button>
    }
</div>